package top.songxs.yygh.task.controller;

import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.StringRedisTemplate;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Api(tags = "设置短信提醒")
@RestController
@RequestMapping("/admin")
public class TaskController {
    @Autowired
    StringRedisTemplate redisTemplate;

    @GetMapping("/task/{status}")
    public String setTaskStatus(@PathVariable String status) {
            if ("1".equals(status)){
                redisTemplate.opsForValue().set("MSM",status);
                return "开启提醒成功";
            }else if ("0".equals(status)){
                redisTemplate.opsForValue().set("MSM",status);
                return "关闭提醒成功";
            }else {
                return "非法操作";
            }
    }
}
